package com.globallogic.vacationplanner.model.dao.impl;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.globallogic.vacationplanner.model.dao.declaration.IVacationDao;
import com.globallogic.vacationplanner.model.entity.Vacation;

@Repository("vacationDao")
@Transactional
public class VacationDao extends BaseDao<Vacation> implements IVacationDao {
	private static final long serialVersionUID = 1L;

	private static Logger LOGGER = Logger.getLogger(VacationDao.class);

	@Override
	String getReadAllQuery() {
		return "from Vacation";
	}

	@Override
	public void deleteVacationRow(Vacation deletedObject) {
		LOGGER.info("in hql query for delete vacaation row");
		Vacation vacation = read(deletedObject);
		if (vacation == null) {
			LOGGER.info("Vacation had not been found");
		} else {
			delete(vacation);
			LOGGER.info("query executed seccess");
		}
	}

}
